#include <stdio.h>
#include <unistd.h>
#include <sys/wait.h>

int main()
{
	pid_t pid1,pid2;
	pid1 = fork();
	if(pid1 > 0)
		pid2 = fork();
	if(pid1 == 0)
	{
		printf("child process 1 : %d starts to run\n",getpid());
		sleep(3);
		printf("child process 1 down\n");
		exit(100);
	}
	if(pid2 == 0)
	{
		printf("child process 2 : %d starts to run\n",getpid());
		sleep(1);
		printf("child process 2 down\n");
		exit(200);
	}
	printf("parent process starts\n");
	int status ; 
	waitpid(pid1 , &status , 0);
	if(WIFEXITED(status))
		printf("the status : %d\n",WEXITSTATUS(status));
	return 0;
}
